// 定义buddy模型
const mongoose = require("mongoose")
const buddySchema = new mongoose.Schema({
	openId: {
		type: String,
		required:[true,'openId不能为空'],
	},
	buddyOpenId: {
		type: String,
		required:[true,'buddyOpenId不能为空'],
	},
  user:{
    type: mongoose.Schema.Types.ObjectId,
    ref: 'users'
 	},
	createTime: {
		type: Date,
		default: new Date()
	},
})
buddySchema.index({openId: 1, buddyOpenId: 1},{unique: true})
const buddyModel = mongoose.model("buddys", buddySchema)
module.exports = buddyModel